package com.dealin.dealinlibs.tool;

import android.graphics.Color;

/**
 * Created by lenovo on 2016/11/8.
 */

public class ColorTool {
    public static String getColorString(int color) {
        StringBuffer sb = new StringBuffer("#");
        if (Color.alpha(color) < 255) {
            sb.append(Color.alpha(color));
        }
        sb.append(Color.red(color));
        sb.append(Color.green(color));
        sb.append(Color.blue(color));
        return sb.toString();
    }

    public static int getColorFromHex(String colorString) throws Exception {
        return Color.parseColor(colorString);
    }
}
